package _interface

type Db interface {
	IsConnLogined(id uint) bool
	AddConn(id uint)
	GetConnId(user string) (uint, bool)
	GetConnUser(id uint) (string, bool)
	ConnDisconnect(id uint) //连接断开
	ConnLogout(user string) //连接退出登录，但还连着

	IsUserExist(user string) bool   //该用户是否已注册
	IsUserLogined(user string) bool //该用户是否已登录
	AddUser(user string, passwd string)
	Login(id uint, user string, passwd string) error
	GetUsersWhoHasFriend(user string) []string
	IsUserHasFriend(user string, friend string) bool
	AddUserFriend(user string, friend string)
	DelUserFriend(user string, friend string)
	GetMyFriendsOnlineStatus(user string) ([]string, []string)
	UserExitAllGroup(user string)
	DelMeFromAllUsers(user string)
	DelUser(user string)

	IsGroupExist(group string) bool
	AddGroup(group string)
	AddGroupMember(group string, user string)
	DelGroupMember(group string, user string)
	GetGroupMembers(group string) []string
	IsGroupHasMember(group string, user string) bool
	TryCleanGroup(group string) bool //如果群成员为空，则删除该群聊，返回是否删除
}
